package com.fuyao.cloud.admin.api.utils;

public class NumberUtils {

    /**
     * 编号自增长
     * @param num
     * @return
     */
    public static String getIncrementNum(String num){
        if (num==null){
            return null;
        }
        char[] cs = num.toCharArray();
        for (int i = cs.length-1; i>=0; i--) {
            if (cs[i]<'9'){
                cs[i]+=1;
                return String.valueOf(cs);
            }
            cs[i]='0';
        }
        char[] cs2 =new char[cs.length+1];
        cs2[0]='1';
        for (int i = 1; i < cs2.length; i++) {
            cs2[i]=cs[i-1];
        }
        return String.valueOf(cs2);
    }
}
